<%@page import="cn.sendto.model.ClassEntity"%>
<%@page import="java.util.List"%>
<%@page import="cn.sendto.mapper.ClassMapper"%>
<%@page import="cn.sendto.dbhelper.DBHelper"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="getSession.jsp" %>
<html>
	<head>
		<meta charset="UTF-8">
		<title>添加学生页面</title>
		<link rel="stylesheet" type="text/css" href="css/global.css"/>
	</head>
	<style type="text/css">
		html{
			background: #dddddd;
		}
		.data{
			width: 60%;
			margin:5% auto;
			text-align: left;
			border: 1px solid darkgray;
		}
		.item,.subm{
			width: 100%;
			margin-top: 20px;
			text-align: center;
			border-bottom: 1px dashed darkgray;
			line-height: 30px;
		}
		.item span{
			font-size: 18px;
			color: dimgrey;
		}
		.item input,select{
			width: 30%;
			height: 30px;
			font-size: 16px;
			color: dimgrey;
			
		}
		.subm input{
			width: 100px; 
			height: 50px; 
			font-size: 18px;
		}
	</style>
	<body>
		<div class="data">
			<form action="add.jsp" method="post">
				<div class="item">
					<span>学生姓名：</span><input type="text" name="studentname" id="stuname" value="提莫" />
				</div>
				<div class="item">
					<span>学生性别：</span><select name="gender">
					<option selected="selected" value="1">男性</option>
					<option value="2">女性</option>
					<option value="3">不详</option>
					</select>
				</div>
				<div class="item">
					<span>学生年龄：</span><input name="age" type="number" value="1" />
				</div>
				<div class="item">
					<span>学生编号：</span><input name="studentno" type="text" value="1" />
				</div>
				<div class="item">
					<span>学生地址：</span><input name="address" type="text" value="1" />
				</div>
				
				<div class="item">
					<span>学生电话：</span><input name="tel" type="tel" value="1" />
				</div>
				
				<div class="item">
					<span>学生班级：</span>
					<select name="classid">
						<%
						DBHelper helper = new DBHelper();
						
						String csql ="select * from classinfo";
						
						ClassMapper classMapper = new ClassMapper();
						
						List<ClassEntity> class_list = helper.executeQuery(csql, classMapper, null);
						
						helper.close();
						for(int i =0;i<class_list.size();i++){
							out.print("<option value='"+class_list.get(i).getClassId()+"'>"+class_list.get(i).getClassName()+"</option>");
						}
						%>
					</select>
				</div>
				<div class="item">
					<span>初始密码：</span><input name="password" type="tel" value="1" />
				</div>
				<div class="subm">
					<input    type="submit" value="添加"/>
				</div>
			</form>
		</div>
	</body>
</html>
